package com.hd.controller;

import com.hd.entity.Advert;
import com.hd.entity.Result;
import com.hd.service.AdvertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
@Controller
public class AdvertController {
    @Autowired
    private AdvertService advertService;

    @RequestMapping("/selectAdverts")
    public Object selectAdverts(){
        List<Advert> adverts = advertService.selectAdverts();
        if(adverts.size()!=0){
            return new Result(200,"查询成功",adverts);
        }else{
            return new Result(400,"查询失败",null);
        }

    }

    @RequestMapping("test")
    public String test(){
        return "test";
    }
}
